﻿/*
 * GNU GENERAL PUBLIC LICENSE v2
 * 
 * Developers: Alan Audette, Oguz Bastemur
 */
namespace SqlDatabaseBackup.Configuration
{
    using System;
    using System.Collections.Generic;
    using System.Configuration;

    //<Email sendOn="both" username="" password="" smtpPort="" smtpHost="" sender="" receipents=""/>
    public class Email : ConfigurationElement
    {
        public enum SendRules
        {
            Never,
            OnFail,
            OnSuccess,
            Both
        }

        [ConfigurationProperty("receipents")]
        public string Receipents
        {
            get
            {
                return this["receipents"] as string;
            }
        }

        [ConfigurationProperty("sender")]
        public string Sender
        {
            get
            {
                return this["sender"].ToString();
            }
        }

        [ConfigurationProperty("smtpHost")]
        public string SMTPHost
        {
            get
            {
                return this["smtpHost"].ToString();
            }
        }

        [ConfigurationProperty("smtpPort")]
        public int SMTPPort
        {
            get
            {
                return (int)this["smtpPort"];
            }
        }

        [ConfigurationProperty("password")]
        public string Password
        {
            get
            {
                return this["password"].ToString();
            }
        }

        [ConfigurationProperty("username")]
        public string Username
        {
            get
            {
                return this["username"].ToString();
            }
        }

        [ConfigurationProperty("sendOn")]
        public SendRules SendOn
        {
            get 
            {
                return (SendRules)this["sendOn"];
            }
        } 
    }
}